# Scrapy settings for item_pipelines project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
#     https://docs.scrapy.org/en/latest/topics/settings.html
#     https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
#     https://docs.scrapy.org/en/latest/topics/spider-middleware.html

BOT_NAME = 'item_pipelines'

SPIDER_MODULES = ['item_pipelines.spiders']
NEWSPIDER_MODULE = 'item_pipelines.spiders'

FILES_STORE = '/Users/farben/Desktop/SpiderResults/files/'
IMAGES_STORE = '/Users/farben/Desktop/SpiderResults/images/'

FEED_EXPORT_ENCODING = 'UTF-8'

# 图片下载大小过滤
IMAGES_MIN_HEIGHT = 1920
IMAGES_MIN_WIDTH = 1080

# 钉钉Robot扩展配置
# ************** 钉钉Robot扩展配置 开始 ****************
ROBOT_ENABLED = True
ROBOT_TOKEN = '36889f721b13044e3ca82346efd8a40d7c2356e8fcf2ffbd9d82fdad92e7da7b'
ROBOT_SECRET = 'SEC68af196b040a65d138e3209e44fd4b085b1d4db93b2aaf7bb058c8de5d0b29c1'
# ************** 钉钉Robot扩展配置 结束 ****************


# 允许下载媒体重定向
# MEDIA_ALLOW_REDIRECTS = True


# Crawl responsibly by identifying yourself (and your website) on the user-agent
# USER_AGENT = 'item_pipelines (+http://www.yourdomain.com)'

# Obey robots.txt rules
ROBOTSTXT_OBEY = False

# AJAXCRAWL_ENABLED = True
# Configure maximum concurrent requests performed by Scrapy (default: 16)
# CONCURRENT_REQUESTS = 32

# Configure a delay for requests for the same website (default: 0)
# See https://docs.scrapy.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
DOWNLOAD_DELAY = 1
# The download delay setting will honor only one of:
# CONCURRENT_REQUESTS_PER_DOMAIN = 16
# CONCURRENT_REQUESTS_PER_IP = 16

# Disable cookies (enabled by default)
# COOKIES_ENABLED = False

# Disable Telnet Console (enabled by default)
# TELNETCONSOLE_ENABLED = False

# Override the default request headers:
# DEFAULT_REQUEST_HEADERS = {
#   'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
#   'Accept-Language': 'en',
# }

# Enable or disable spider middlewares
# See https://docs.scrapy.org/en/latest/topics/spider-middleware.html
# SPIDER_MIDDLEWARES = {
#    'item_pipelines.middlewares.ItemPipelinesSpiderMiddleware': 543,
# }

# Enable or disable downloader middlewares
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html
# DOWNLOADER_MIDDLEWARES = {
#    'item_pipelines.middlewares.ItemPipelinesDownloaderMiddleware': 543,
# }

# Enable or disable extensions
# See https://docs.scrapy.org/en/latest/topics/extensions.html
EXTENSIONS = {
   'item_pipelines.extensions.DingdingRobot': 500,
}

# Configure item pipelines
# See https://docs.scrapy.org/en/latest/topics/item-pipeline.html
ITEM_PIPELINES = {
   'item_pipelines.pipelines.CustomFilesPipeline': 30,
   'item_pipelines.pipelines.CustomImagesPipelin': 31,
}

# Enable and configure the AutoThrottle extension (disabled by default)
# See https://docs.scrapy.org/en/latest/topics/autothrottle.html

AUTOTHROTTLE_ENABLED = True
# The initial download delay
AUTOTHROTTLE_START_DELAY = 5
# The maximum download delay to be set in case of high latencies
AUTOTHROTTLE_MAX_DELAY = 60
# The average number of requests Scrapy should be sending in parallel to
# each remote server
AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
# Enable showing throttling stats for every response received:
AUTOTHROTTLE_DEBUG = True

# Enable and configure HTTP caching (disabled by default)
# See https://docs.scrapy.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
# HTTPCACHE_ENABLED = True
# HTTPCACHE_EXPIRATION_SECS = 0
# HTTPCACHE_DIR = 'httpcache'
# HTTPCACHE_IGNORE_HTTP_CODES = []
# HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
